package com.example.dto;

import com.example.model.dto.BaseDTO;
import com.example.utils.DateUtils;
import com.example.validator.group.AddGroup;
import com.example.validator.group.DefaultGroup;
import com.example.validator.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 用户表
 *
 * @author yyyyjinying 1020066395@qq.com
 * @since 1.0-SNAPSHOT 2025-06-15
 */
@Data
@Schema(description = "用户表")
public class MdlUserDTO extends BaseDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Null(message = "{id.null}", groups = AddGroup.class)
    @NotNull(message = "{id.require}", groups = UpdateGroup.class)
    @Schema(description = "用户唯一ID")
    private Long id;
    @Schema(description = "微信开放ID")
    private String openid;
    @Schema(description = "微信UnionID（用于多应用用户统一）")
    private String unionid;
    @Schema(description = "微信登录会话密钥")
    private String sessionKey;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "用户名")
    private String username;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "法号")
    private String dharmaName;
    @Schema(description = "密码（建议加密存储）")
    private String password;
    @Schema(description = "手机号")
    private String phone;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "是否激活：0未激活，1激活")
    private Integer isActive;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "是否是会员：0不是，1是")
    private Integer isMember;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "会员等级（1:普通会员, 2:黄金会员, 3:白金会员等）")
    private Integer memberLevel;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "出生日期")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern= DateUtils.DATE_PATTERN)
    @DateTimeFormat(pattern = DateUtils.DATE_PATTERN)
    private Date birthDate;
    @Schema(description = "省份")
    private String province;
    @Schema(description = "城市")
    private String city;
    @Schema(description = "区县")
    private String district;
    @Schema(description = "详细地址")
    private String detailAddress;
    @NotNull(message = "{id.require}", groups = DefaultGroup.class)
    @Schema(description = "性别：0男，1女")
    private Integer sex;
    @Schema(description = "头像URL")
    private String avatarUrl;
    @Schema(description = "累计福报值")
    private Integer totalMerit;

}